package com.itjiange;

import lombok.Data;

import java.util.HashMap;
import java.util.Map;

/**
 * 商场信息
 *
 * @author ItJianGe
 * @data 2024/8/12 16:12
 */
@Data
public class MarketInfoClient {

    private Map<Integer, MarketInfo> marketPool = new HashMap<>();

    public MarketInfoClient() {
        MarketInfo marketInfo1 = new MarketInfo(1, "红门子华联超市");
        MarketInfo marketInfo2 = new MarketInfo(2, "西站华联超市");
        MarketInfo marketInfo3 = new MarketInfo(3, "西关零食有鸣");

        marketPool.put(marketInfo1.getId(), marketInfo1);
        marketPool.put(marketInfo2.getId(), marketInfo2);
        marketPool.put(marketInfo3.getId(), marketInfo3);
    }

    public MarketInfo getMarketInfo(int key) {
        return marketPool.get(key) != null ? marketPool.get(key) : new MarketInfo(666, "就近超市");
    }
}
